
#include <vector>
#include <opencv2/opencv.hpp>
#include "../include/Wraper.h"
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
using namespace INTRAFACE;

typedef void(WINAPI * PINITER)(int);

typedef void   (WINAPI * PCTOR) (const char* detectionModel, const char* trackingModel,const XXDescriptor* pXXD, const cv::Rect_<double>& offset);
typedef bool (WINAPI* pt_Initialized)();
typedef INTRAFACE::IFRESULT(WINAPI* pt_Detect)(const cv::Mat& image, const cv::Rect& face, cv::Mat& landmarks, float& score);

HMODULE hMod = NULL;
FaceAlignmentWraper* CreateFacePointsEngine()
{
	FaceAlignmentWraper* engine = new FaceAlignmentWraper();
	if (!engine->CreateFaceAlignment(""))
	{
		delete engine;
		engine = NULL;
	}


	return engine;
}

float CalculateFacePoints(FaceAlignmentWraper* engine, unsigned char* imgBgr24, int width,
	int height, int widthstep, FaceFeatureRectangle &faceRect, FacePointsModel* pointModel)
{
	int landmarks_count = 0;
	float score, notFace = 0.5;
	if (engine)
	{
		return engine->GetFacePoints(imgBgr24, width, height, widthstep, faceRect, pointModel);

	}
	return score;
}

//bool CalculateHeadPose(FaceAlignmentWraper* engine, unsigned char* imgBgr24, int width,
//	int height, int widthstep, FacePointsModel* pointModel)
//{
//	if (engine)
//	{
//		return engine->CalculateHeadPose(imgBgr24, width, height, widthstep, pointModel);
//	}
//	return false;
//}
//
//
void FreeFacePointsEngine(FaceAlignmentWraper* engine)
{
	if (engine)
	{
		engine->Free();
		delete engine;
		engine = NULL;
	}
}